#! /bin/sh

#set -e

rpm -q rpm >/dev/null 2>&1 && set remove # for RPMs made with "alien -vvrc"

case "$1" in
	   remove|deconfigure)
	        [ -x "`which xdg-mime`" ] && xdg-mime uninstall --novendor /usr/share/klik/cmg-mimetype.xml >/dev/null
	        [ -x "`which xdg-icon-resource`" ] && xdg-icon-resource uninstall --novendor --size 48 /usr/share/klik/application-x-extension-cmg.png >/dev/null
	        [ -x "`which xdg-desktop-menu`" ] && xdg-desktop-menu uninstall --novendor /usr/share/klik/klik.desktop >/dev/null
# lintian says gconftools must go
	        if [ -x "`which gconftool-2 2>/dev/null`" ]; then
			export GCONF_CONFIG_SOURCE=$(gconftool-2 --get-default-source)
			gconftool-2 --makefile-uninstall-rule /usr/share/klik/cmg-gnome-thumbnail.schema >/dev/null
			gconftool-2 --makefile-uninstall-rule /usr/share/klik/klik-protocol.schema >/dev/null
		fi
		;;


       upgrade)
        ;;
       purge)
#		if [ -e /usr/share/debconf/confmodule ]; then
#			# Source debconf library.
#			. /usr/share/debconf/confmodule
#			# Remove my changes to the db.
#			db_purge
#		fi
        ;;
    *)
        echo "prerm called with unknown argument \`$1'" >&2
        exit 1
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
